from datetime import datetime
import time
from os import times

from Comm.Driver import gdriver


# 导航条
class NavigationBar:
    def __init__(self):
        gdriver.click(gdriver.find_element("body > div > div.navbar > a:nth-child(2)"))
        gdriver.save_screenshot("../Images/" + "题库_" + datetime.now().strftime("%Y%m%d_%H%M%S") + ".png")

        # 以下功能暂未开发
        gdriver.click(gdriver.find_element("body > div > div.navbar > a.login"))
        time.sleep(2)
        gdriver.save_screenshot("../Images/" + "登录_" + datetime.now().strftime("%Y%m%d_%H%M%S") + ".png")
        gdriver.click(gdriver.find_element("body > div > a"))

        gdriver.click(gdriver.find_element("body > div > div.navbar > a:nth-child(3)"))
        time.sleep(2)
        gdriver.save_screenshot("../Images/" + "竞赛_" + datetime.now().strftime("%Y%m%d_%H%M%S") + ".png")
        gdriver.click(gdriver.find_element("body > div > a"))

        gdriver.click(gdriver.find_element("body > div > div.navbar > a:nth-child(4)"))
        time.sleep(2)
        gdriver.save_screenshot("../Images/" + "讨论_" + datetime.now().strftime("%Y%m%d_%H%M%S") + ".png")
        gdriver.click(gdriver.find_element("body > div > a"))

        gdriver.click(gdriver.find_element("body > div > div.navbar > a:nth-child(5)"))
        time.sleep(2)
        gdriver.save_screenshot("../Images/" + "求职_" + datetime.now().strftime("%Y%m%d_%H%M%S") + ".png")
        gdriver.click(gdriver.find_element("body > div > a"))
